/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ventanaFacade;

import dao.AbstractFacade;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.event.ListDataListener;
import modelo.InterfazFacadeModelo;

/**
 *
 * @author carlos
 */
public class ModeloComboBox extends DefaultComboBoxModel
{
    private AbstractFacade facade;
        
    public ModeloComboBox(AbstractFacade facade) 
    {
        super();
        this.facade=facade;
        cargarDatos();
    }
    
        
     public void cargarDatos()
    {
       // this.removeRow(row);
        this.removeAllElements();
        Vector<Object> lista=facade.getAll();
        for (Iterator<Object> it = lista.iterator(); it.hasNext();) {
            InterfazFacadeModelo object = (InterfazFacadeModelo) it.next();
            this.addElement(object);
            
        }
    }
    
    
}
